meta %>%
filter(su_tract == 1) %>%
select(varname, about) %>% as.list()
## $varname
## [1] "tract" "consproviders" "busproviders" "avgMaxAdDown"
## [5] "avgMaxAdUp" "p_under25.3mbps"
##
## $about
## [1] "11-digit tract code"
## [2] "The number of consumer internet providers in the su"
## [3] "The number of business internet providers in the su"
## [4] "The average maximum advertised download speed by each broadband provider in the su"
## [5] "The average maxmum advertised upload speed by each broadband provider in the su"
## [6] "The proportion of census blocks within the block group/tract that have internet speeds under 25/3 Mbps, and therefore don't meet the FCC benchmark for \"advanced telecommunications capability\""
glimpse(cvldat)
## Rows: 50
## Columns: 6
## $ tract <dbl> 51003010100, 51003010201, 51003010202, 51003010300, 51…
## $ consproviders <int> 7, 7, 7, 8, 11, 9, 8, 8, 7, 7, 8, 7, 8, 8, 9, 10, 9, 9…
## $ busproviders <int> 10, 11, 8, 14, 15, 11, 12, 12, 8, 13, 12, 11, 10, 12, …
## $ avgMaxAdDown <dbl> 34.61370, 68.18137, 101.83574, 87.94751, 51.45219, 127…
## $ avgMaxAdUp <dbl> 2.476170, 4.461158, 6.062087, 5.104725, 13.994239, 34.…
## $ p_under25.3mbps <dbl> 0.21315789, 0.25203252, 0.07692308, 0.16030534, 0.2296…
cvldat %>% select(consproviders, busproviders, avgMaxAdDown, avgMaxAdUp, p_under25.3mbps) %>%
select(where(~is.numeric(.x))) %>%
as.data.frame() %>%
stargazer(., type = "text", title = "Summary Statistics", digits = 2,
summary.stat = c("mean", "sd", "min", "median", "max"))
##
## Summary Statistics
## ===================================================
## Statistic Mean St. Dev. Min Median Max
## ---------------------------------------------------
## consproviders 8.24 1.24 6 8 12
## busproviders 10.90 2.14 7 11 15
## avgMaxAdDown 111.62 55.00 29.56 102.42 215.29
## avgMaxAdUp 27.09 29.49 2.00 12.28 96.05
## p_under25.3mbps 0.11 0.13 0.00 0.08 0.84
## ---------------------------------------------------
cvldat %>% select(c(tract, consproviders, busproviders, avgMaxAdDown, avgMaxAdUp, p_under25.3mbps)) %>%
pivot_longer(-tract, names_to = "measure", values_to = "value") %>%
ggplot(aes(x = value, fill = measure)) +
scale_fill_viridis(option = "plasma", discrete = TRUE, guide = FALSE) +
geom_histogram() +
facet_wrap(~measure, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
meta %>%
filter(varname %in% c("consproviders", "busproviders", "avgMaxAdDown", "avgMaxAdUp", "p_under25.3mbps")) %>%
mutate(label = paste0(varname, ": ", about)) %>%
select(label) %>%
as.list()
$label [1] "consproviders: The number of consumer internet providers in the su"
[2] "busproviders: The number of business internet providers in the su"
[3] "avgMaxAdDown: The average maximum advertised download speed by each broadband provider in the su"
[4] "avgMaxAdUp: The average maxmum advertised upload speed by each broadband provider in the su"
[5] "p_under25.3mbps: The proportion of census blocks within the block group/tract that have internet speeds under 25/3 Mbps, and therefore don't meet the FCC benchmark for "advanced telecommunications capability""
pal <- colorNumeric("plasma", reverse = TRUE, domain = mapdat$consproviders)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = mapdat,
fillColor = ~pal(consproviders),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 2,
fillOpacity = 0.8,
bringToFront = T
),
popup = paste0("GEOID: ", mapdat$tract, "<br>",
"Number of internet providers: ", mapdat$consproviders)
) %>%
addLegend("bottomright", pal = pal, values = mapdat$consproviders,
title = "Number of internet <br> providers", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = mapdat$avgMaxAdDown)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = mapdat,
fillColor = ~pal(avgMaxAdDown),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 2,
fillOpacity = 0.8,
bringToFront = T
),
popup = paste0("GEOID: ", mapdat$tract, "<br>",
"Average max advertised <br> download speeds: ", round(mapdat$avgMaxAdDown, 2))
) %>%
addLegend("bottomright", pal = pal, values = mapdat$avgMaxAdDown,
title = "Average maximum <br>advertised <br>download speeds", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = mapdat$avgMaxAdUp)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = mapdat,
fillColor = ~pal(avgMaxAdUp),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 2,
fillOpacity = 0.8,
bringToFront = T
),
popup = paste0("GEOID: ", mapdat$tract, "<br>",
"Average max <br> advertised upload speeds: ", round(mapdat$avgMaxAdUp, 2))
) %>%
addLegend("bottomright", pal = pal, values = mapdat$avgMaxAdUp,
title = "Average maximum <br>advertised <br> upload speeds", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = (mapdat$p_under25.3mbps *100))
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = mapdat,
fillColor = ~pal((mapdat$p_under25.3mbps *100)),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 2,
fillOpacity = 0.8,
bringToFront = T
),
popup = paste0("GEOID: ", mapdat$tract, "<br>",
"Percent of blocks <br>without advanced <br>telecommunications capability: ", round((mapdat$p_under25.3mbps *100), 2))
) %>%
addLegend("bottomright", pal = pal, values = (mapdat$p_under25.3mbps *100),
title = "Percent of blocks <br>without advanced <br>telecommunications capability", opacity = 0.7)